﻿using System.Collections.Generic;
using System.Text;
using System.IO;
using System.Diagnostics;
using System.Collections;

using Ninject.Modules;
using Ninject;

using System.Net.DnsToolkit.Packet;
using System.Net.DnsToolkit.Packet.Records;
using System.Net.DnsToolkit.Configuration;
using System.Net.DnsToolkit.Serializer;

namespace System.Net.DnsToolkit.TestUnit.Helper {

    public static class DnsReader {


        static readonly IMessageReader<System.IO.Stream> reader;
        static DnsReader() {

            var dsr = new DnsReaderStreamModule();
            IKernel kernel = new StandardKernel(dsr);
            reader = kernel.Get<IMessageReader<System.IO.Stream>>();
        }

        public static bool TryRead(System.IO.Stream stream, out IMessage message) {

            return reader.TryRead(stream, out message);
        }

        public static IMessage Read(System.IO.Stream stream) {
            return reader.Read(stream);
        }

    }

}
